package com.mp.chart.formatter;

import java.text.DecimalFormat;

public class ChengJiaoLiangFormatter implements ValueFormatter {

    private final int mJishu;
    private DecimalFormat mFormat;

    public ChengJiaoLiangFormatter(int jishu) {
        if (jishu == 1) {
            mFormat = new DecimalFormat("#0");
        } else {
            mFormat = new DecimalFormat("#0.00");
        }
        mJishu = jishu;
    }

    @Override
    public String getFormattedValue(float value) {
        value = value / mJishu;
        return mFormat.format(value);
    }

}
